<!DOCTYPE html>
<html>
	<head>
		<meta charset="UTF-8">
		<meta name="renderer" content="webkit">
		<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
		<meta name="viewport" content="width=device-width,user-scalable=yes, minimum-scale=0.4, initial-scale=0.8,target-densitydpi=low-dpi" />
		<link rel="shortcut icon" href="/favicon.ico" type="image/x-icon" />
		<link rel="stylesheet" href="/css/font.css">
		<link rel="stylesheet" href="/css/xadmin.css">
	</head>

	<body>
		<div class="x-body" id="app">
			<a class="layui-btn layui-btn-small" style="line-height:1.6em;margin-top:3px;float:right" href="javascript:location.replace(location.href);"
			 title="刷新"><i class="layui-icon" style="line-height:30px">ဂ</i></a>
			<span class="x-right" style="line-height:40px;float:left">共有数据：{{ stuRewards.length }} 条</span>
			<table class="layui-table">
				<thead>
					<tr>
						<th width="50">序号</th>
						<th width="150">获取时间</th>
						<th width="150">奖惩类型</th>
                        <th>奖惩原因</th>
						<th width="50">操作</th>
				</thead>
				<tbody>
					<tr v-for="(stuReward, index) in stuRewards">
						<td>{{ index+1 }}</td>
						<td>{{ stuReward.time }}</td>
						<td>{{ stuReward.type }}</td>
						<td style="max-width: 160px;overflow: hidden;text-overflow:ellipsis;white-space: nowrap;">{{ stuReward.reason }}</td>
						<td class="td-manage">
						    <button class="layui-btn layui-btn-sm" onclick="open_editTchReward(this)" :data-id="stuReward.id" href="javascript:;"><i
                                 class="layui-icon">&#xe642;</i>查看</button>
						</td>
					</tr>
				</tbody>
			</table>
		</div>
		<script type="text/javascript" src="/js/jquery.min.js"></script>
        <script type="text/javascript" src="/js/xadmin.js"></script>
        <script type="text/javascript" src="/lib/layui/layui.js" charset="utf-8"></script>
        <script type="text/javascript" src="/js/vue.min.js"></script>
        <script type="text/javascript" src="/js/jquery.form.js"></script>
		<script>
			var vm = new Vue({
	            el : '#app',
	            data : {
	                // 学生奖惩信息
	                stuRewards : ""
	            },
	            created : function() {
	                // 获取当前学生奖惩信息
	               this.listStuReward();
	            },
	            methods : {
	            	listStuReward : function() {
	                    var vm = this;
	                    $.ajax({
	                        url : "/student/info/listStuReward",
	                        type : "get",
	                        success : function(result) {
	                            if (result.state) {
	                                vm.stuRewards = result.data;
	                            } else {
	                                layui.use(['layer'], function(){
	                                    var layer = layui.layer
	                                    layer.msg(""+result.msg, {icon: 5});
	                                });
	                            }
	                        }
	                    });
	                }
	            }
	        });

			// 查看学生奖惩信息
			function open_editTchReward(obj) {
				var rewardId = $(obj).attr("data-id");
				x_admin_show('查看','/student/info/toLookStuReward?rewardId=' + rewardId, 600, 300);
			}
			
		</script>
	</body>

</html>
